var constant = require('../../core/common/constant');
orderService.$inject = ['$http'];

function orderService($http) {

    return {
        getOrders:getOrders,
        updateOrders:updateOrders
    }

    function getOrders(status,callBack){
        var baseUrl = constant.BaseUrl+'/sec/op/order';
        console.log("status:"+status);
        $http.get(baseUrl+'/'+status)
            .then(function successCallback(response) {
                callBack(response);
            }, function errorCallback(response) {
                // 请求失败执行代码
                callBack(response);
            });
    }

    function updateOrders(data,callBack){
        var baseUrl = constant.BaseUrl+'/sec/op/order/status';
        $http.put(baseUrl,data).then(function successCallback(response) {
            callBack(response);
        }, function errorCallback(response) {
            // 请求失败执行代码
            callBack(response);
        });
    }


}

module.exports = orderService;